%% 
% 球面三角
theta=linspace(0,2*pi,360);
r=5;
scatter3(0,0,0,'g')
hold on
text(0,0,0,'球心');
xlabel('x');
ylabel('y');
zlabel('z');
% 
a=r.*cos(theta);
b=r.*sin(theta);
c=zeros(360);
plot3(a,b,c,'g');
plot3(a,c,b,'k');
% 坐标轴
quiver3(0,0,0,1.5*r,0,0,1,'k','filled','LineWidth',1);  %三维箭头
text(1.5*r+1,0,0,'x');
quiver3(0,0,0,0,1.5*r,0,1,'k','filled','LineWidth',1);  %三维箭头
text(0,1.5*r+1,0,'y');
quiver3(0,0,0,0,0,1.5*r,1,'k','filled','LineWidth',1);  %三维箭头
text(0,0,1.5*r+1,'z');

% %% 
% % 大圆
% circle_theta(r,pi/4);
% text(-3,-2.8,-2.8,'大圆');
% hold on
% % % 小圆
% r_sc=4;
% x=linspace(-r_sc,r_sc,50);
% y=sqrt(r_sc^2-x.^2);
% z=ones(50)*sqrt(r^2-r_sc^2);
% plot3(x,y,z,'r');
% plot3(-x,-y,z,'r');
% text(0,-4,3,'小圆');
% scatter3(0,0,3,'g')
% text(0,0,3,'小圆心');
% %% 
% scatter3(0,0,3,'g')
% scatter3(0,0,r,'g')
% scatter3(0,0,-r,'g')
% plot3([0,0],[0,0],[-r,r],'g');
% 
% text(0,0,r,'圆的极');
% text(0,0,-r,'圆的极');

gamma=pi/4;
x=linspace(-r,r,50);
y=sqrt((r^2-x.^2)/(1+tan(gamma)^2));
z=y.*tan(gamma);
plot3(x,y,z,'r');
% plot3(-x,-y,-z,'r');

gamma=-pi/4;
x=linspace(-r,r,50);
y=sqrt((r^2-x.^2)/(1+tan(gamma)^2));
z=y.*tan(gamma);
plot3(x,y,z,'r');

scatter3(r,0,0,'g')
scatter3(-r,0,0,'g')
